﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace cmsservice.DAL
{
    public class Em_Block_StockDal
    {
        public List<string> GetStockByBlock(string blockCode)
        {
            List<string> lst = new List<string>();
            blockCode = blockCode == null ? "" : blockCode;
            blockCode = blockCode.Replace("'", "");
            string sql = " SELECT SecuCode FROM EM_BLOCK_STOCK WHERE BlockCode='" + blockCode + "'";
            DataTable tb = SqlHelper.ExecuteGetTable(DBConn.NewDMSConnstr, CommandType.Text, sql, null);
            foreach (DataRow row in tb.Rows)
            {
                string secuCode =Tools.GetString(row["SecuCode"]);
                lst.Add(secuCode);
            }
            return lst;
        }

        public string GetStockByBlock_Str(string blockCode)
        {
            List<string> lst = GetStockByBlock(blockCode);
            var arr=lst.Select(x=>"'"+x+"'").ToList();
            return string.Join(",", arr);
        }
    }
}
